<h1>Listing prescriptions</h1>

<table>
  <thead>
    <tr>
      <th>Drug</th>
      <th>Appointment</th>
      <th>Dosage</th>
      <th>Quantity</th>
      <th>Fee</th>
      <th>Note</th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @prescriptions.each do |prescription| %>
      <tr>
        <% prescription.drugs.each do |d| %>
        	<td><%= d.name %></td>
        <% end %>
        <td><%= prescription.appointment_id %></td>
        <td><%= prescription.dosage %></td>
        <td><%= prescription.quantity %></td>
        <td><%= prescription.fee %></td>
        <td><%= prescription.note %></td>
        <td><%= link_to 'Show', prescription %></td>
        <td><%= link_to 'Edit', edit_prescription_path(prescription) %></td>
        <td><%= link_to 'Destroy', prescription, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Prescription', new_prescription_path %>
